import router from "@/router/index.js";

router.beforeEach((to,from,next) => {
    const flag = sessionStorage.getItem("satoken");
    console.log(!flag)
    console.log(flag)
    if(!flag){
        // 未登录
        if (to.matched.length > 0 && !to.matched.some(reduce => reduce.meta.requiresAuth)){
            next()
        }else{
            next({
                path: "/login"
            })
        }
    }else{
        next()
    }
})
